home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / disk / cdrom / MusicBox-2.1os.lha / MusicBox / MusicBox_lib.asm < prev    next >
Encoding:
Assembly Source File  |  2000-09-29  |  12.3 KB  |  666 lines

  1.  ; ##########################################################################
  2.  ; ####                                                                  ####
  3.  ; ####                        The MusicBox Project                      ####
  4.  ; ####                    ============================                  ####
  5.  ; ####                                                                  ####
  6.  ; #### MusicBox_lib.asm                                                 ####
  7.  ; ####                                                                  ####
  8.  ; #### Version 2.1os  --  September 29, 2000                            ####
  9.  ; ####                                                                  ####
  10.  ; #### Copyright (C) 1994  Thomas Dreibholz                             ####
  11.  ; ####               2000  Molbachweg 7                                 ####
  12.  ; ####                     51674 Wiehl                                  ####
  13.  ; ####                     Germany                                      ####
  14.  ; ####                                                                  ####
  15.  ; ####                     EMail: Dreibholz@bigfoot.com                 ####
  16.  ; ####                     WWW:   http://www.bigfoot.com/~dreibholz     ####
  17.  ; ####                                                                  ####
  18.  ; ##########################################################################
  19.  
  20.  ; ***************************************************************************
  21.  ; *                                                                         *
  22.  ; *   This program is free software; you can redistribute it and/or modify  *
  23.  ; *   it under the terms of the GNU General Public License as published by  *
  24.  ; *   the Free Software Foundation; either version 2 of the License, or     *
  25.  ; *   (at your option) any later version.                                   *
  26.  ; *                                                                         *
  27.  ; ***************************************************************************
  28.  
  29.  ; MusicBox-Library Grundstruktur
  30.  
  31.  include "exec/types.i"
  32.  include "exec/initializers.i"
  33.  include "exec/libraries.i"
  34.  include "exec/lists.i"
  35.  include "exec/nodes.i"
  36.  include "exec/resident.i"
  37.  include "libraries/dos.i"
  38.  include "exec/alerts.i"
  39.  
  40.  
  41. CALLSYS  MACRO
  42.  jsr _LVO%1(a6)
  43.  endm
  44.  
  45. XLIB  MACRO
  46.  xref _LVO%1
  47.  endm
  48.  
  49.  STRUCTURE MusicBoxLib,LIB_SIZE
  50.   ULONG mbl_SysLib
  51.   ULONG mbl_DosLib
  52.   ULONG mbl_IntLib
  53.   ULONG mbl_FontLib
  54.   ULONG mbl_GfxLib
  55.   ULONG mbl_LocLib
  56.   ULONG mbl_GTLib
  57.   ULONG mbl_VerLib
  58.   ULONG mbl_SegList
  59.   UBYTE mbl_Flags
  60.   UBYTE mbl_Pad
  61.  LABEL MusicBoxLib_SIZEOF
  62.  
  63.  XLIB OpenLibrary
  64.  XLIB CloseLibrary
  65.  XLIB FreeMem
  66.  XLIB Remove
  67.  XLIB Alert
  68.  XLIB CloseCatalog
  69.  XLIB CloseLocale
  70.  XLIB OpenCatalogA
  71.  XLIB OpenLocale
  72.  
  73.  XREF _AddUser
  74.  XREF _RemUser
  75.  XREF _PutCommand
  76.  XREF _CheckResult
  77.  XREF _WaitResult
  78.  XREF _MusicBoxCommand
  79.  XREF _MusicBoxCommand1
  80.  XREF _MusicBoxCommand2
  81.  XREF _InformationA
  82.  XREF _MultiRequestA
  83.  XREF _EasyCommand
  84.  XREF _IconifyMusicBox
  85.  XREF _UnIconifyMusicBox
  86.  XREF _IconifyArchive
  87.  XREF _UnIconifyArchive
  88.  XREF _OpenArchive
  89.  XREF _CreatePort
  90.  XREF _DeletePort
  91.  XREF _CreateExtIO
  92.  XREF _DeleteExtIO
  93.  XREF _NewList
  94.  XREF _GetLStr
  95.  XREF _ErrorL
  96.  XREF _DisplayCatalog
  97.  XREF _CreateProcess
  98.  XREF _MacFormat
  99.  XREF _PutText
  100.  XREF _PutMText
  101.  XREF _OffsetX
  102.  XREF _OffsetY
  103.  XREF _InitSleepPointer
  104.  XREF _RemoveSleepPointer
  105.  XREF _SleepPointer
  106.  XREF _DeleteMMPort
  107.  XREF _SetupPrinter
  108.  XREF _PrintIt
  109.  XREF _CleanUpPort
  110.  XREF _LibVersionCheck
  111.  
  112. Version   equ 38
  113. Revision  equ 2
  114. Pri       equ 5
  115.  
  116. Start:
  117.  moveq #0,d0
  118.  rts
  119.  
  120. Resident:
  121.  dc.w RTC_MATCHWORD
  122.  dc.l Resident
  123.  dc.l EndCode
  124.  dc.b RTF_AUTOINIT
  125.  dc.b Version
  126.  dc.b NT_LIBRARY
  127.  dc.b Pri
  128.  dc.l LibName
  129.  dc.l idString
  130.  dc.l Init
  131.  
  132. LibName:  dc.b 'musicbox.library',0
  133. verID:    dc.b '$VER: musicbox.library 2.1os (Sep 29 2000) - Copyright (C) 1994-2000 by Thomas Dreibholz',0
  134. idString: dc.b 'musicbox.library 38.2 (Sep 29 2000)',13,10,0
  135. DosName:  dc.b 'dos.library',0
  136. IntName:  dc.b 'intuition.library',0
  137. GfxName:  dc.b 'graphics.library',0
  138. FontName: dc.b 'diskfont.library',0
  139. LocName:  dc.b 'locale.library',0
  140. GTName:   dc.b 'gadtools.library',0
  141. CatName:  dc.b 'musicbox.catalog',0
  142. VerName:  dc.b 'version.library',0
  143.  even
  144.  public _SleepPointerData
  145. _SleepPointerData:
  146.  dc.w   0,0
  147.  dc.w  %0000011000000000,%0000011000000000
  148.  dc.w  %0000111101000000,%0000111101000000
  149.  dc.w  %0011111111100000,%0011111111100000
  150.  dc.w  %0111111111100000,%0111111111100000
  151.  dc.w  %0111111111110000,%0110000111110000
  152.  dc.w  %0111111111111000,%0111101111111000
  153.  dc.w  %1111111111111000,%1111011111111000
  154.  dc.w  %0111111111111100,%0110000111111100
  155.  dc.w  %0111111111111100,%0111111100001100
  156.  dc.w  %0011111111111110,%0011111111011110
  157.  dc.w  %0111111111111100,%0111111110111100
  158.  dc.w  %0011111111111100,%0011111100001100
  159.  dc.w  %0001111111111000,%0001111111111000
  160.  dc.w  %0000011111110000,%0000011111110000
  161.  dc.w  %0000000111000000,%0000000111000000
  162.  dc.w  %0000011100000000,%0000011100000000
  163.  dc.w  %0000111111000000,%0000111111000000
  164.  dc.w  %0000011010000000,%0000011010000000
  165.  dc.w  %0000000000000000,%0000000000000000
  166.  dc.w  %0000000011000000,%0000000011000000
  167.  dc.w  %0000000011100000,%0000000011100000
  168.  dc.w  %0000000001000000,%0000000001000000
  169.  dc.w  0,0
  170. _SleepPointerEnd:
  171.  public _SleepPointerSize
  172. _SleepPointerSize:
  173.  dc.l _SleepPointerEnd-_SleepPointerData
  174.  even
  175.  
  176. EndCode:
  177.  
  178. Init:
  179.  dc.l MusicBoxLib_SIZEOF
  180.  dc.l FuncTable
  181.  dc.l DataTable
  182.  dc.l InitRoutine
  183.  
  184. FuncTable:
  185.  dc.l Open
  186.  dc.l Close
  187.  dc.l Expunge
  188.  dc.l Null
  189.  
  190.  dc.l .AddUser
  191.  dc.l .RemUser
  192.  dc.l .PutCommand
  193.  dc.l .CheckResult
  194.  dc.l .WaitResult
  195.  
  196.  dc.l .MusicBoxCommand
  197.  dc.l .MusicBoxCommand1
  198.  dc.l .MusicBoxCommand2
  199.  
  200.  dc.l .InformationA
  201.  dc.l .MultiRequestA
  202.  
  203.  dc.l .EasyCommand
  204.  dc.l .IconifyMusicBox
  205.  dc.l .UnIconifyMusicBox
  206.  dc.l .IconifyArchive
  207.  dc.l .UnIconifyArchive
  208.  dc.l .OpenArchive
  209.  
  210.  dc.l .CreatePortA
  211.  dc.l .DeletePortA
  212.  dc.l .CreateExtIOA
  213.  dc.l .DeleteExtIOA
  214.  dc.l .NewListA
  215.  
  216.  dc.l .GetLStr
  217.  dc.l .ErrorL
  218.  dc.l .DisplayCatalog
  219.  dc.l .CreateProcess
  220.  
  221.  dc.l .MacFormat
  222.  dc.l .PutText
  223.  dc.l .PutMText
  224.  dc.l .OffsetX
  225.  dc.l .OffsetY
  226.  
  227.  dc.l .SleepPointer
  228.  
  229.  dc.l .DeleteMMPort
  230.  dc.l .CleanUpPort
  231.  
  232.  dc.l .SetupPrinter
  233.  dc.l .PrintIt
  234.  
  235.  dc.l .LibVersionCheck
  236.  
  237.  dc.l -1
  238.  
  239. DataTable:
  240.  INITBYTE LH_TYPE,NT_LIBRARY
  241.  INITLONG LN_NAME,LibName
  242.  INITBYTE LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
  243.  INITWORD LIB_VERSION,Version
  244.  INITWORD LIB_REVISION,Revision
  245.  INITLONG LIB_IDSTRING,idString
  246.  dc.l 0
  247.  
  248. InitRoutine:
  249.  move.l a5,-(a7)
  250.  move.l d0,a5
  251.  move.l #0,_Catalog
  252.  move.l #0,_Locale
  253.  move.l a6,mbl_SysLib(a5)
  254.  move.l a0,mbl_SegList(a5)
  255.  move.l $4,_SysBase
  256.  lea DosName(pc),a1
  257.  move.l #37,d0
  258.  CALLSYS OpenLibrary
  259.  move.l d0,mbl_DosLib(a5)
  260.  move.l d0,_DOSBase
  261.  bne.s 1$
  262.  move.l #0,a5
  263.  bra InitRoutine_end
  264. 1$:
  265.  lea GfxName(pc),a1
  266.  move.l #37,d0
  267.  CALLSYS OpenLibrary
  268.  move.l d0,mbl_GfxLib(a5)
  269.  move.l d0,_GfxBase
  270.  bne.s 2$
  271.  move.l #0,a5
  272.  bra InitRoutine_end
  273. 2$:
  274.  lea IntName(pc),a1
  275.  move.l #37,d0
  276.  CALLSYS OpenLibrary
  277.  move.l d0,mbl_IntLib(a5)
  278.  move.l d0,_IntuitionBase
  279.  bne.s 3$
  280.  move.l #0,a5
  281.  bra InitRoutine_end
  282. 3$:
  283.  lea FontName(pc),a1
  284.  move.l #37,d0
  285.  CALLSYS OpenLibrary
  286.  move.l d0,mbl_FontLib(a5)
  287.  move.l d0,_DiskfontBase
  288.  bne.s 4$
  289.  move.l #0,a5
  290.  bra InitRoutine_end
  291. 4$:
  292.  lea LocName(pc),a1
  293.  move.l #38,d0
  294.  CALLSYS OpenLibrary
  295.  move.l d0,mbl_LocLib(a5)
  296.  move.l d0,_LocaleBase
  297. 5$:
  298.  lea GTName(pc),a1
  299.  move.l #37,d0
  300.  CALLSYS OpenLibrary
  301.  move.l d0,mbl_GTLib(a5)
  302.  move.l d0,_GadToolsBase
  303.  bne.s 6$
  304.  move.l #0,a5
  305.  bra InitRoutine_end
  306. 6$:
  307.  lea VerName(pc),a1
  308.  move.l #0,d0
  309.  CALLSYS OpenLibrary
  310.  move.l d0,mbl_VerLib(a5)
  311.  move.l d0,_VersionBase
  312. 7$:
  313.  
  314.  movem.l d0-d7/a0-a6,-(sp)
  315.  ; ------------------------------------
  316.  move.l #0,a0
  317.  move.l _LocaleBase,a6
  318.  cmpa.l #0,a6
  319.  beq 10$
  320.  jsr _LVOOpenLocale(a6)
  321.  move.l d0,_Locale
  322.  tst.l d0
  323.  beq 10$
  324.  move.l d0,a0
  325.  move.l #CatName,a1
  326.  move.l #0,a2
  327.  jsr _LVOOpenCatalogA(a6)
  328.  move.l d0,_Catalog
  329. 10$:
  330.  ; ------------------------------------
  331.  jsr _InitSleepPointer(pc)
  332.  movem.l (sp)+,d0-d7/a0-a6
  333.  
  334. InitRoutine_end
  335.  move.l a5,d0
  336.  move.l (a7)+,a5
  337.  rts
  338.  
  339. Open:
  340.  addq.w #1,LIB_OPENCNT(a6)
  341.  bclr #LIBB_DELEXP,mbl_Flags(a6)
  342.  move.l a6,d0
  343.  rts
  344.  
  345. Close:
  346.  clr.l d0
  347.  subq.w #1,LIB_OPENCNT(a6)
  348.  bne.s 1$
  349.  btst #LIBB_DELEXP,mbl_Flags(a5)
  350.  beq.s 1$
  351.  bsr Expunge
  352. 1$:
  353.  rts
  354.  
  355. Expunge:
  356.  movem.l d2/a5-a6,-(a7)
  357.  move.l a6,a5
  358.  move.l mbl_SysLib(a5),a6
  359.  tst.w LIB_OPENCNT(a5)
  360.  beq.s 1$
  361.  bset #LIBB_DELEXP,mbl_Flags(a5)
  362.  clr.l d0
  363.  bra Expunge_end
  364. 1$:
  365.  move.l mbl_SegList(a5),d2
  366.  move.l a5,a1
  367.  CALLSYS Remove
  368.  movem.l d0-a7/a0-a6,-(sp)
  369.  ; ------------------------------------
  370.  move.l mbl_LocLib(a5),a6
  371.  move.l _Locale,a0
  372.  cmpa.l #0,a0
  373.  beq Locale_okay
  374.  jsr _LVOCloseLocale(a6)
  375.  move.l _Catalog,a0
  376.  cmpa.l #0,a0
  377.  beq Locale_okay
  378.  jsr _LVOCloseCatalog(a6)
  379. Locale_okay:
  380.  ; ------------------------------------
  381.  movem.l (sp)+,d0-a7/a0-a6
  382.  jsr _RemoveSleepPointer(pc)
  383.  move.l mbl_VerLib(a5),a1
  384.  cmpa.l #0,a1
  385.  beq Version_okay
  386.  CALLSYS CloseLibrary
  387. Version_okay:
  388.  move.l mbl_DosLib(a5),a1
  389.  CALLSYS CloseLibrary
  390.  move.l mbl_IntLib(a5),a1
  391.  CALLSYS CloseLibrary
  392.  move.l mbl_GfxLib(a5),a1
  393.  CALLSYS CloseLibrary
  394.  move.l mbl_FontLib(a5),a1
  395.  CALLSYS CloseLibrary
  396.  move.l mbl_LocLib(a5),a1
  397.  CALLSYS CloseLibrary
  398.  move.l mbl_GTLib(a5),a1
  399.  CALLSYS CloseLibrary
  400.  clr.l d0
  401.  move.l a5,a1
  402.  move.w LIB_NEGSIZE(a5),d0
  403.  sub.l d0,a1
  404.  add.w LIB_POSSIZE(a5),d0
  405.  CALLSYS FreeMem
  406.  move.l d2,d0
  407. Expunge_end:
  408.  movem.l (a7)+,d2/a5-a6
  409.  rts
  410.  
  411. Null:
  412.  moveq #0,d0
  413.  rts
  414.  
  415. .AddUser:
  416.  move.l a0,-(sp)
  417.  jsr _AddUser(pc)
  418.  addq.w #4,sp
  419.  rts
  420.  
  421. .RemUser:
  422.  move.l a0,-(sp)
  423.  jsr _RemUser(pc)
  424.  addq.w #4,sp
  425.  rts
  426.  
  427. .PutCommand:
  428.  move.l a0,-(sp)
  429.  jsr _PutCommand(pc)
  430.  addq.w #4,sp
  431.  rts
  432.  
  433. .CheckResult:
  434.  move.l a0,-(sp)
  435.  jsr _CheckResult(pc)
  436.  addq.w #4,sp
  437.  rts
  438.  
  439. .WaitResult:
  440.  move.l a0,-(sp)
  441.  jsr _WaitResult(pc)
  442.  addq.w #4,sp
  443.  rts
  444.  
  445. .MusicBoxCommand:
  446.  move.l d0,-(sp)
  447.  move.l a0,-(sp)
  448.  jsr _MusicBoxCommand(pc)
  449.  addq.w #8,sp
  450.  rts
  451.  
  452. .MusicBoxCommand1:
  453.  move.l d0,-(sp)
  454.  move.l d0,-(sp)
  455.  move.l a0,-(sp)
  456.  jsr _MusicBoxCommand1(pc)
  457.  add.w #12,sp
  458.  rts
  459.  
  460. .MusicBoxCommand2:
  461.  move.l d0,-(sp)
  462.  move.l d1,-(sp)
  463.  move.l d0,-(sp)
  464.  move.l a0,-(sp)
  465.  jsr _MusicBoxCommand2(pc)
  466.  add.w #16,sp
  467.  rts
  468.  
  469. .InformationA:
  470.  move.l a0,-(sp)
  471.  jsr _InformationA(pc)
  472.  addq.w #4,sp
  473.  rts
  474.  
  475. .MultiRequestA:
  476.  move.l a2,-(sp)
  477.  move.l a1,-(sp)
  478.  move.l a0,-(sp)
  479.  jsr _MultiRequestA(pc)
  480.  add.w #12,sp
  481.  rts
  482.  
  483. .EasyCommand:
  484.  move.l d2,-(sp)
  485.  move.l d1,-(sp)
  486.  move.l d0,-(sp)
  487.  move.l a0,-(sp)
  488.  jsr _EasyCommand(pc)
  489.  add.w #16,sp
  490.  rts
  491.  
  492. .IconifyMusicBox:
  493.  jsr _IconifyMusicBox(pc)
  494.  rts
  495.  
  496. .UnIconifyMusicBox:
  497.  jsr _UnIconifyMusicBox(pc)
  498.  rts
  499.  
  500. .IconifyArchive:
  501.  jsr _IconifyArchive(pc)
  502.  rts
  503.  
  504. .UnIconifyArchive:
  505.  jsr _UnIconifyArchive(pc)
  506.  rts
  507.  
  508. .OpenArchive:
  509.  move.l d2,-(sp)
  510.  move.l d1,-(sp)
  511.  move.l d0,-(sp)
  512.  jsr _OpenArchive(pc)
  513.  add.w #12,sp
  514.  rts
  515.  
  516. .CreatePortA:
  517.  move.l d0,-(sp)
  518.  move.l a0,-(sp)
  519.  jsr _CreatePort(pc)
  520.  addq.w #8,sp
  521.  rts
  522.  
  523. .DeletePortA:
  524.  move.l a0,-(sp)
  525.  jsr _DeletePort(pc)
  526.  addq.w #4,sp
  527.  rts
  528.  
  529. .CreateExtIOA:
  530.  move.l d0,-(sp)
  531.  move.l a0,-(sp)
  532.  jsr _CreateExtIO(pc)
  533.  addq.w #8,sp
  534.  rts
  535.  
  536. .DeleteExtIOA:
  537.  move.l a0,-(sp)
  538.  jsr _DeleteExtIO(pc)
  539.  addq.w #4,sp
  540.  rts
  541.  
  542. .NewListA:
  543.  move.l a0,-(sp)
  544.  jsr _NewList(pc)
  545.  addq.w #4,sp
  546.  rts
  547.  
  548. .GetLStr:
  549.  move.l a0,-(sp)
  550.  move.l d0,-(sp)
  551.  jsr _GetLStr(pc)
  552.  addq.w #8,sp
  553.  rts
  554.  
  555. .ErrorL:
  556.  move.l a0,-(sp)
  557.  move.l d0,-(sp)
  558.  jsr _ErrorL(pc)
  559.  addq.w #8,sp
  560.  rts
  561.  
  562. .DisplayCatalog:
  563.  move.l d0,-(sp)
  564.  move.l a0,-(sp)
  565.  jsr _DisplayCatalog(pc)
  566.  addq.w #8,sp
  567.  rts
  568.  
  569. .CreateProcess:
  570.  move.l d2,-(sp)
  571.  move.l d1,-(sp)
  572.  move.l d0,-(sp)
  573.  move.l a0,-(sp)
  574.  jsr _CreateProcess(pc)
  575.  add.w #16,sp
  576.  rts
  577.  
  578. .MacFormat:
  579.  move.l d0,-(sp)
  580.  move.l a1,-(sp)
  581.  move.l a0,-(sp)
  582.  jsr _MacFormat(pc)
  583.  add.w #12,sp
  584.  rts
  585.  
  586. .PutText:
  587.  move.l a1,-(sp)
  588.  move.l d1,-(sp)
  589.  move.l d0,-(sp)
  590.  move.l a0,-(sp)
  591.  jsr _PutText(pc)
  592.  add.w #16,sp
  593.  rts
  594.  
  595. .PutMText:
  596.  move.l d2,-(sp)
  597.  move.l a1,-(sp)
  598.  move.l d1,-(sp)
  599.  move.l d0,-(sp)
  600.  move.l a0,-(sp)
  601.  jsr _PutMText(pc)
  602.  add.w #20,sp
  603.  rts
  604.  
  605. .OffsetX:
  606.  move.l a0,-(sp)
  607.  jsr _OffsetX(pc)
  608.  addq.w #4,sp
  609.  rts
  610.  
  611. .OffsetY:
  612.  move.l a0,-(sp)
  613.  jsr _OffsetY(pc)
  614.  addq.w #4,sp
  615.  rts
  616.  
  617. .SleepPointer
  618.  move.l a0,-(sp)
  619.  jsr _SleepPointer(pc)
  620.  addq.w #4,sp
  621.  rts
  622.  
  623. .DeleteMMPort:
  624.  move.l a0,-(sp)
  625.  jsr _DeleteMMPort(pc)
  626.  addq.w #4,sp
  627.  rts
  628.  
  629. .SetupPrinter
  630.  jsr _SetupPrinter(pc)
  631.  rts
  632.  
  633. .PrintIt:
  634.  move.l a1,-(sp)
  635.  move.l a0,-(sp)
  636.  jsr _PrintIt(pc)
  637.  addq.w #8,sp
  638.  rts
  639.  
  640. .CleanUpPort:
  641.  move.l a0,-(sp)
  642.  jsr _CleanUpPort(pc)
  643.  addq.w #4,sp
  644.  rts
  645.  
  646. .LibVersionCheck:
  647.  move.l d0,-(sp)
  648.  jsr _LibVersionCheck(pc)
  649.  addq.w #4,sp
  650.  rts
  651.  
  652.  global _GfxBase,4
  653.  global _IntuitionBase,4
  654.  global _DOSBase,4
  655.  global _DiskfontBase,4
  656.  global _SysBase,4
  657.  global _LocaleBase,4
  658.  global _GadToolsBase,4
  659.  global _VersionBase,4
  660.  
  661.  global _Catalog,4
  662.  global _Locale,4
  663.  
  664.  END
  665.  
  666.